
package com.probiz.estoresa.system.web.action;

import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;

import com.probiz.estore.common.model.system.Region;
import com.probiz.estore.core.controller.GenericStoreAdminController;
import com.probiz.estore.system.service.RegionManager;

public class UserDefinedRegionSelectorController extends GenericStoreAdminController<Region> {

	private RegionManager		regionManager;

	public void setRegionManager(RegionManager manager) {
		this.regionManager = manager;
	}

	@Override
	protected String getEntityName(Region entity) {
		return null;
	}


	@Override
	protected void initController() throws Exception {
		mgr = regionManager;
	}

	@Override
	protected void preSave(HttpServletRequest request, Region entity,
			BindException errors) {

	}

	public ModelAndView defaultAction(HttpServletRequest request,
			HttpServletResponse response) {
		ModelAndView mv = new ModelAndView("system/userDefinedRegionSelector");
		List<Region> regionList = regionManager.getAllUserDefinedRegion();
		mv.addObject("regionList", regionList);
		return mv;
	}



}
